home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / CUGUK / GAMES / C059B.ZIP / TOP.ZIP / MAKEFILE.TOP < prev    next >
Text File  |  1990-07-18  |  4KB  |  127 lines

  1. #    Hack Makefile.
  2. #    SCCS Id: @(#)Makefile.top    3.0    89/03/23
  3.  
  4. # newer makes predefine $(MAKE) to 'make' and do smarter processing of
  5. # recursive make calls if $(MAKE) is used
  6. # these makes allow $(MAKE) to be overridden by the environment if someone
  7. # wants to (or has to) use something other than the standard make, so we do
  8. # not want to unconditionally set $(MAKE) here
  9. #
  10. # unfortunately, some older makes do not predefine $(MAKE); if you have one of
  11. # these, uncomment the following line
  12. # (you will know that you have one if you get complaints about unable to
  13. # execute things like 'data' and 'rumors')
  14. # MAKE = make
  15.  
  16. # make NetHack
  17. GAME     = nethack
  18. GAMEUID  = games
  19. GAMEGRP  = bin
  20.  
  21. # GAMEDIR also appears in config.h as "HACKDIR".
  22. #
  23. # note that 'make install' believes in creating a nice tidy GAMEDIR for
  24. # installation, free of debris from previous NetHack versions --
  25. # therefore there should not be anything in GAMEDIR that you want to keep
  26. # (if there is, you'll have to do the installation by hand or modify the
  27. # instructions)
  28. GAMEDIR  = /usr/games/lib/$(GAME)dir
  29. SHELLDIR = /usr/games
  30. MANDIR   = /usr/man/man6
  31. MANEXT   = 6
  32.  
  33. # manual installation for most BSD-style systems
  34. GAMEMANCREATE = cp auxil/nethack.6
  35. LEVMANCREATE = cp auxil/lev_comp.6
  36. # manual installation for most SYSV-style systems
  37. # GAMEMANCREATE = nroff -man auxil/nethack.6 >
  38. # LEVMANCREATE = nroff -man auxil/lev_comp.6 >
  39.  
  40. AUXHELP = help hh cmdhelp history opthelp oracles
  41. VARAUX = data rumors
  42. SPEC_LEVS = endgame castle tower1 tower2 tower3
  43. AUX = $(AUXHELP) $(VARAUX) $(SPEC_LEVS) license
  44.  
  45. $(GAME):
  46.     ( cd src ; $(MAKE) )
  47.  
  48. all:    $(GAME) Guidebook data rumors spec_levs
  49.     @echo "Done."
  50.  
  51. Guidebook:
  52.     ( cd auxil ; $(MAKE) Guidebook )
  53.  
  54. data:
  55.     ( cd auxil ; $(MAKE) data )
  56.  
  57. rumors:
  58.     ( cd auxil ; $(MAKE) rumors )
  59.  
  60. spec_levs:
  61.     ( cd src ; $(MAKE) lev_comp )
  62.     ( cd auxil ; $(MAKE) spec_levs )
  63.     
  64. update: $(GAME) data rumors spec_levs
  65. # copy over new versions of the game files
  66.     ( cd auxil ; cp $(AUX) $(GAMEDIR) )
  67. #    (don't yank the old version out from under people who're playing it)
  68.     -mv $(GAMEDIR)/$(GAME) $(GAMEDIR)/$(GAME).old
  69.     cp src/$(GAME) $(GAMEDIR)
  70.     -rm -f $(SHELLDIR)/$(GAME)
  71.     sed -e 's;/usr/games/lib/nethackdir;$(GAMEDIR);' \
  72.         -e 's;HACKDIR/nethack;HACKDIR/$(GAME);' \
  73.         < auxil/nethack.sh \
  74.         > $(SHELLDIR)/$(GAME)
  75. # correct the permissions on the new versions
  76.     -( cd $(GAMEDIR) ; chown $(GAMEUID) $(AUX) $(GAME) ; \
  77.             chgrp $(GAMEGRP) $(AUX) $(GAME) ; \
  78.             chmod 644 $(AUX) )
  79.     -chown $(GAMEUID) $(SHELLDIR)/$(GAME)
  80.     chgrp $(GAMEGRP) $(SHELLDIR)/$(GAME)
  81.     chmod 0755 $(SHELLDIR)/$(GAME)
  82.     chmod 04755 $(GAMEDIR)/$(GAME)
  83. # touch time-sensitive files
  84.     -touch -c $(GAMEDIR)/bones* $(GAMEDIR)/?lock* $(GAMEDIR)/wizard*
  85.     -touch -c $(GAMEDIR)/save/*
  86.     touch $(GAMEDIR)/perm $(GAMEDIR)/record
  87. # and copy the man pages
  88.     -$(GAMEMANCREATE) $(MANDIR)/$(GAME).$(MANEXT)
  89.     -$(LEVMANCREATE) $(MANDIR)/lev_comp.$(MANEXT)
  90.  
  91. install: $(GAME) data rumors spec_levs
  92. # set up the directories
  93.     -mkdir $(SHELLDIR)
  94.     -rm -rf $(GAMEDIR)
  95.     -mkdir $(GAMEDIR) $(GAMEDIR)/save
  96. # create some files
  97.     touch $(GAMEDIR)/perm $(GAMEDIR)/record $(GAMEDIR)/logfile
  98. # copy over the game files
  99.     ( cd auxil ; cp $(AUX) $(GAMEDIR) )
  100.     cp src/$(GAME) $(GAMEDIR)
  101.     -rm -f $(SHELLDIR)/$(GAME)
  102.     sed -e 's;/usr/games/lib/nethackdir;$(GAMEDIR);' \
  103.         -e 's;HACKDIR/nethack;HACKDIR/$(GAME);' \
  104.         < auxil/nethack.sh \
  105.         > $(SHELLDIR)/$(GAME)
  106. # set up the permissions
  107.     -chown $(GAMEUID) $(SHELLDIR)/$(GAME) $(GAMEDIR) $(GAMEDIR)/*
  108.     chgrp $(GAMEGRP) $(SHELLDIR)/$(GAME) $(GAMEDIR) $(GAMEDIR)/*
  109.     chmod 0755 $(SHELLDIR)/$(GAME)
  110.     chmod 644 $(GAMEDIR)/*
  111.     chmod 755 $(GAMEDIR) $(GAMEDIR)/save
  112.     chmod 04755 $(GAMEDIR)/$(GAME)
  113. # and copy the man pages
  114.     -$(GAMEMANCREATE) $(MANDIR)/$(GAME).$(MANEXT)
  115.     -$(LEVMANCREATE) $(MANDIR)/lev_comp.$(MANEXT)
  116.  
  117. # 'make clean' removes all the .o files, but leaves around all the executables
  118. # and compiled data files
  119. clean:
  120.     ( cd src ; $(MAKE) clean )
  121.  
  122. # 'make spotless' returns the source tree to near-distribution condition.
  123. # it removes .o files, executables, and compiled data files
  124. spotless:
  125.     ( cd src ; $(MAKE) spotless )
  126.     ( cd auxil ; $(MAKE) spotless )
  127.